<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<!DOCTYPE html>
<html>
<head>
    <jsp:include page="/WEB-INF/jsp/include/head.jsp"/>
    <style>
        .detailTable {
            margin-bottom: 0px;
        }
        .detailTable th {
            width: 26%;
        }
        .detailTable td {
            width: 37%;
        }
    </style>
</head>
<body>
<ol class="breadcrumb">
    <li><strong>当前位置： </strong>标准化管理</li>
    <li class="active">管理员审核</li>
</ol>


<div class="panel panel-info">
    <div class="panel-heading">
        <h3 class="panel-title selectslid" style="display: inline-block">查询</h3>
    </div>
    <div class="panel-body">
        <form id="form_search" class="form-horizontal row">
            <div class="form-group col-sm-4 ">
                <label class="control-label col-sm-4 ">专家姓名：</label>
                <div class="col-sm-8">
                    <input type="text" class="form-control" name="expertName">
                </div>
            </div>

            <div class="form-group col-sm-4 ">
                <label class="col-sm-4 control-label">信息类型：</label>
                <div class="col-sm-8">
                    <select class="form-control" name="tableName">
                        <option value="">&nbsp;</option>
                        <option value="EMS_EXPERT_BASE">基本信息</option>
                        <option value="EMS_EXPERT_COMPANY">工作单位</option>
                        <option value="EMS_EXPERT_CERTIFICATE">资质证书</option>
                        <option value="EMS_EXPERT_MAJOR">从事专业</option>
                        <option value="EMS_EXPERT_WORK">工作经历</option>
                        <option value="EMS_EXPERT_TRAIN">培训经历</option>
                        <option value="EMS_EXPERT_EDUCATION">教育经历</option>
                        <option value="EMS_EXPERT_REVIEW">审查/评审经历</option>
                    </select>
                </div>
            </div>
            <div class="form-group col-sm-2">
                <div class="col-sm-8 col-sm-offset-4">
                    <button id="btn_search" type="button" class="btn btn-default "><span
                            class="glyphicon glyphicon-search"></span>&nbsp;查&nbsp;询&nbsp;</button>
                </div>
            </div>
        </form>
    </div>
</div>


<table id="table_data"></table>


<div class="modal fade" id="modal_ajax">
    <div class="modal-dialog    modal-lg ">
        <div class="modal-content ">
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->


<jsp:include page="/WEB-INF/jsp/include/footer.jsp"/>


<script>


    var $table_data = $('#table_data');
    $("#btn_search").click(function () {
        refreshTable()
    });

    function refreshTable() {
        $table_data.bootstrapTable('refresh');
    }

    var tableName = {
        "EMS_EXPERT_BASE": "基本信息",
        "EMS_EXPERT_COMPANY": "工作单位",
        "EMS_EXPERT_CERTIFICATE": "资质证书",
        "EMS_EXPERT_MAJOR": "从事专业",
        "EMS_EXPERT_WORK": "工作经历",
        "EMS_EXPERT_TRAIN": "培训经历",
        "EMS_EXPERT_EDUCATION": "教育经历",
        "EMS_EXPERT_REVIEW": "审查/评审经历"
    };

    $table_data.bootstrapTable({
        url: 'expertInfo/adminCheck/select',
        striped: true,
        cache: false,
        sidePagination: 'server',
        pageSize: 10,
        pageList: [10, 30, 50, 100, 300],
        pageNumber: 1,
        pagination: true,
        queryParams: function (params) {
            $.extend(params, $("#form_search").serializeObject());
            return params
        },
        columns: [
            {
                formatter: function (value, row, index) {
                    return index + 1
                }
            },
            {
                field: 'name',
                title: '专家姓名'

            },
            {
                field: 'idCard',
                title: '身份证号'
            },
            {
                field: 'tableName',
                title: '信息类型',
                formatter: function (value, row, index) {
                    return $.sysPlugin.ifElse(value, tableName);
                }
            },
            {
                field: 'crudType',
                title: '操作类型',
                formatter: function (value, row, index) {
                    return $.sysPlugin.ifElse(value, $.sysPlugin.enumeration.operationType);
                }
            },
            {
                title: '操作',
                events: 'operateEvents',
                formatter: function (value, row, index) {



                    return [
                        '<button type="button" class="btn btn-xs btn-default btn-info check_data">' +
                        '<span class="glyphicon glyphicon-check"></span> 审 核' +
                        '</button>'
                    ].join('');
                }
            }
        ]
    });


    var url = 'expertInfo/adminCheck/checkResult';
    window.operateEvents = {
        'click .check_data': function (e, value, row, index) {
            $('#modal_ajax').modal({
                backdrop: 'static',
                keyboard: false,
                show: true,
                remote: 'expertInfo/adminCheck/showDetail?id=' + row.id + '&tableName=' + row.tableName,
            });
        }
    };


    function disagreeApplyFun(id, tableName) {
        swal({
                    title: "",
                    text: "请详细说明驳回原因：",
                    type: "input",
                    showCancelButton: true,
                    closeOnConfirm: false,
                    animation: "slide-from-top",
                    inputPlaceholder: "不能为空！"
                },
                function (inputValue) {
                    if (inputValue === false) return false;
                    if (inputValue.trim() === "") {
                        swal.showInputError("驳回原因不能为空！");
                        return false
                    }
                    $.sysPlugin.superAjax({
                        data: {
                            id: id,
                            tableName: tableName,
                            result: false,
                            reason: inputValue
                        },
                        url: url,
                        operateType: '驳回',
                        showSuccessAlert: true,
                        showWarnAlert: false,
                        successCall: function (data) {
                            $.sysPlugin.successCallBack(data, {
                                table: $table_data,
                                modal: $("#modal_ajax")
                            });
                        }
                    });
                }
        );
    }

    function agreeApplyFun(id, tableName) {
        $.sysPlugin.superAjax({
            data: {
                id: id,
                tableName: tableName,
                result: true
            },
            url: url,
            operateType: 'other',
            showSuccessAlert: true,
            showWarnAlert: true,
            successCall: function (data) {
                $.sysPlugin.successCallBack(data, {
                    table: $table_data,
                    modal: $("#modal_ajax")
                });

            }
        });
    }

    $.sysPlugin.clearModalRemoveData("modal_ajax");
    $.sysPlugin.initSimpleSelect2();

</script>
</body>
</html>
